//
//  PopSheetViewViewController.m
//  UILbrary
//
//  Created by Apple on 2023/3/23.
//  Copyright © 2023 mac. All rights reserved.
//

#import "PopSheetViewViewController.h"
#import "PopSheetView.h"

@interface PopSheetViewViewController ()

@end

@implementation PopSheetViewViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    
    UIButton *myButton = [UIButton buttonWithType:UIButtonTypeSystem];
    myButton.backgroundColor = [UIColor redColor];
    myButton.frame = CGRectMake(0, 0, 150, 50);
    [myButton setTitle:@"Click me" forState:UIControlStateNormal];
    [myButton addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
    NSLog(@"Button clicked");
    [self.view addSubview:myButton];
    myButton.center = self.view.center;
}

- (void)buttonAction:(UIButton *)button
{
    NSLog(@"buttonAction");
    NSMutableArray <NSString *>*m_array = [@[] mutableCopy];
    [m_array addObject:@"这是内容1"];
    [m_array addObject:@"这是内容2"];
    [m_array addObject:@"这是内容3"];
    
    [PopSheetView showAlertSheetViewWithTitle:@"标题" contentList:m_array selectBlock:^(NSInteger idx, NSString * _Nonnull name) {
        NSLog(@"idx = %ld, name = %@",idx,name);
        
    } canselBlock:^{
        NSLog(@"取消外部回调");
    }];
}

@end
